package part12;

/**
 * @author wcj
 * @Date 2021/5/21 16:23
 * @Version 1.0
 */
public class Part1210 {

    /**
     * 即便try语句中有return,也不影响finally的执行
     * @param i
     */
    public static void f(int i) {
        try {
            System.out.println("1");
            if (i == 1) {
                return;
            }
            System.out.println("2");
            if (i == 2) {
                return;
            }
            System.out.println("3");
            if (i == 3) {
                return;
            }
            return;
        } finally {
            System.out.println("finally");
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            f(i);
        }
    }
}
